package user.zc.service;

import user.zc.config.system.template.TemplateConfig;
import user.zc.config.system.template.LocalTemplateConfig;
import user.zc.config.value.Key;
import user.zc.util.ConfigGroupHelper;

import java.util.List;

/**
 * @author zhouchuang
 * @date 2023/8/9 14:47
 */
public class SystemTemplateService {

    public List<String> templates()throws Exception{
        return ConfigGroupHelper.getInst().get(LocalTemplateConfig.class).templates();
    }

    public List<Key> read(String fileName)throws Exception{
        return ((TemplateConfig)ConfigGroupHelper.getInst().get(fileName)).getData();
    }
    public void saveOrUpdate(String fileName,List<Key> list) throws Exception {
        TemplateConfig config = null;
        if((config=ConfigGroupHelper.getInst().get(fileName))==null){
            ConfigGroupHelper.getInst().get(LocalTemplateConfig.class).
        }else{

        }
        ConfigGroupHelper.getInst().get(fileName).saveOrUpdate(fileName,list);
    }

}
